home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 11
/
Cream of the Crop 11-1.iso
/
comm
/
ftp4w24b.zip
/
vb
/
ftpproto.bas
< prev
next >
Wrap
BASIC Source File
|
1995-01-18
|
2KB
|
95 lines
'FTP_UTIL.BAS
'contains all global variables for the application
'and some routines
'
Global Const Dir_file = "C:\WINDOWS\FTP_UTIL.LIS" 'dir list info
'
Global HostName As String
Global Userid As String
Global Password As String
Global Sessie As String
'
Global Connected As Integer 'flag to indicate connection
Global OkDialog As Integer 'return variable from other forms
Global Success As Integer 'return variable from Ftp functions
Global Transtype As Integer 'should be Asc("A") or Asc("I")
Global DirType As Integer 'True = long; False = short
Global MaskType As String 'default = *.*
Global Src_nam As String 'source file name
Global Dest_nam As String 'destination file name
'
Sub Do_the_dirlist ()
'list directory info in a file identified with Dir_file
'read the contents of that file and put results in
'listbox Dir_list
'
Dim d_File
Filt$ = MaskType
d_File = Dir_file
If Connected Then
Ftp_form!Dir_list.Clear
Success = FtpDir(Filt$, d_File, DirType, Hwnd, Ms%)
If Success = FTPERR_OK Then
Show_the_dir_list
Else
M$ = FTP4W_Error(Success)
Ftp_form!Message.Caption = M$
End If
End If
'
End Sub
Function Get_mask_type () As String
'
Dim Answer$, DefVal, Msg, Title
'
DefVal = MaskType
Msg = "Enter file mask : "
Title = "File mask"
'
Answer = InputBox$(Msg, Title, DefVal)
'
Get_mask_type = Answer
'
End Function
Sub Show_the_dir_list ()
'read the file and display the contents in the
'list box
'
Dim Lines As Integer, FileNum As Integer
Dim Txt As String, Ch As String * 1
'
FileNum = FreeFile
Lines = 0
'
On Error GoTo Err_term
Open Dir_file For Input As #FileNum
Txt = ""
Do While Not EOF(FileNum)
Ch = Input$(1, #FileNum)
If Ch <> Chr$(13) Then
Txt = Txt & Ch
Else
Lines = Lines + 1
Ftp_form!Dir_list.AddItem Txt
Txt = ""
Ch = Input$(1, #FileNum) 'read the linefeed
End If
Loop
Close #FileNum
'
If Lines = 0 Then
Txt = "No files found"
Ftp_form!Dir_list.AddItem Txt
End If
Exit Sub
'
Err_term:
Ftp_form!Message.Caption = "Error in Dir list file"
Exit Sub
End Sub